# Under the Roof of Rebels: Civilian Targeting After Territorial Takeover in Siera Leone

This repository contains all of the data and code necessary to replicate the results contained in Under the Roof of Rebels: Civilian Targeting After Territorial Takeover in Sierra Leone and its Supplemental Information.

# Files

This repository contains the following files:

- Analysis.R: produces the main results in the main text
- Appendix.Rmd: produces all results in the SI and all numerical in-text results in the main text
- Data
    - cshapes
        - cshapes.*: global country shapefile with capitals
    - diamonds
        - dDIAL.*: global diamond deposit shapefile
    - events
        - Africa_1997-2018_upd-Jul23.csv: ACLED event data
        - ged172.Rdata: GED event data
        - ucdp-onesided-181.csv: UCDP one sided violence data
    - qual_sample.csv: randomly sampled event descriptions and qualitative codings
    - rasters
        - nightlights.tif: nightlights year 2000
        - pop_dens.tif: population density year 2000
    - roads
        - A_and_B_all_utm29_distance_aggregated_to_AandB_junctions.*: road shapefile
    - subnational boundaries
        - gadm36_SLE_2_sf.rds: second order administative division boundaries shapefile
- README.md: this file
- Taxonomies
    - actor_taxonomy.csv: actor taxonomy file for meltt
    - event_taxonomy.csv: event taxonomy file for meltt
    - precision_taxonomy.csv: precision taxonomy file for meltt
- template.tex: LaTeX R Markdown template used to produce SI

# R Packages

Analyses were conducted with R version 3.5.1. The following packages (versions used for analysis listed) and their dependencies are necessary to carry out the analyses:

- corrplot: 0.84
- dplyr: 0.8.3
- ggplot2: 3.2.1
- lubridate: 1.7.4
- mwa: 0.4.1
- meltt: 0.4.0
- raster: 3.0-2
- reshape2: 1.4.3
- rJava: 0.9-11
- sf: 0.8-0
- sp: 1.3-1
- units: 0.6-4
- xtable: 1.8-4

For full details on package versions used in the analysis, see the Computing Environment section of the Supplemental Information.

# Replicating Results

After installing all required packages and dependencies above, run Analysis.R and knit Appendix.Rmd to produce all results in the article and SI, respectively. These files are independent of one another and can be run in any order. Figure 1 in the paper is a representation of theoretical expectations, and so is not produced by Analysis.Rmd.